package com.junxian.springboot03.juc;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class ThreadTest {

    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        for(int i=0; i<2000; i++){
            String str = UUID.randomUUID().toString();
            new Thread(()->{
                list.add(str);
                System.out.println("线程名称：" + Thread.currentThread().getName() + "--" + JSON.toJSON(list));
            }).start();
        }

        System.out.println(list.size() + "个");
    }
}
